package com.example.demo.server3.affair;


import com.example.demo.server3.template.CMPP_CONNECT;
import com.example.demo.server3.template.CMPP_CONNECT_RESP;
import com.example.demo.server3.template.MessageHeader;
import com.example.demo.server3.template.ProtocolTemplate;
import com.example.demo.server3.tool.MD5;

import java.util.concurrent.ConcurrentHashMap;

public class ConnectDetection {

    public final static ConcurrentHashMap concurrentHashMap = new ConcurrentHashMap();

    public static CMPP_CONNECT_RESP connectDetection(ProtocolTemplate protocolTemplate){
        CMPP_CONNECT cmpp_connect = (CMPP_CONNECT) protocolTemplate;
        //假装验证完身份并且成功了
        MessageHeader messageHeader = new MessageHeader(30,0x80000001,cmpp_connect.getMessageHeader().getSequence_Id());
        CMPP_CONNECT_RESP cmpp_connect_resp = new CMPP_CONNECT_RESP();
        cmpp_connect_resp.setMessageHeader(messageHeader);
        cmpp_connect_resp.setStatus((byte)0);
        cmpp_connect_resp.setAuthenticatorISMG(MD5.EncoderByMd5("0"+cmpp_connect.getAuthenticatorSource()+"501026"));
        cmpp_connect_resp.setVersion((byte)2);

        return cmpp_connect_resp;
    }


}
